
EXEC = model_demo
PCOM = model_demo.i
SRC_FILES = $(wildcard *.c)
OBJ_FILES = $(patsubst %.c, %.o, $(SRC_FILES))
LIBS = -lednn
LIB_PATH = $(ROOT_PATH)

INCLUDE_PATHS := -I$(ROOT_PATH)/include \
			     -I$(ROOT_PATH)/include/layers



all: compile build

.PHONY: precompile
precompile:
	$(CC) $(INCLUDE_PATHS) -E $(SRC_FILES) -o $(PCOM) 

.PHONY: compile
compile:$(OBJ_FILES)
$(OBJ_FILES): %.o:%.c
%.o:%.c
	$(CC) $(CFLAGS) $(INCLUDE_PATHS) -c $< -o $@

.PHONY: build
build:$(EXEC)
$(EXEC):$(OBJ_FILES)
	$(CC) $(CFLAGS) -o $@ $^ -L$(LIB_PATH) $(LIBS)

.PHONY: clean
clean:
	del *.o *.i *.exe
